#pragma once
// #include <MSWSock.h>
#include "Type.h"

struct CustomBuf
{
	enum
	{
		BIGBUF = 10240,		//10K
		SYNBUFSIZE = 1024,	//1K
		SMALLBUF = 64		//2^6
	};
};

class RecvLine
{
public:
	RecvLine(void);
	RecvLine(SOCKET s);
	virtual ~RecvLine(void);
	void CopyLine(void);
	SOCKET GetSock(void) { return m_nConn; }
	char *GetCopyBuf(void) { return m_cCopyBuf; }
	bool GetClosed(void) { return m_bClosed; }

protected:
	SOCKET m_nConn;
	char *m_pcCopy;
	char *m_pcCopyParse;
	char m_cCopyBuf[CustomBuf::SYNBUFSIZE + 1];
	int m_nRecvByte;

private:
	bool Receive(SOCKET s);
	int m_nCopyByte;
	char m_cRecvBuf[CustomBuf::BIGBUF + 1];
	char *m_pcRecv;
	char *m_pcRecvEnd;
	bool m_bClosed;
};

